const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.code 项目编号
 * @param {} options.name 项目名称
 * @param {} options.workItemCategoryId 维修项目分类Id，维修项目所关联的分类或其上层分类Id
 * @param {} options.productCategoryId 产品分类Id（车型Id）
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        workItemCategoryId: req.query.workItemCategoryId,
        productCategoryId: req.query.productCategoryId,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'workItemId1650',
                    code: 'workItemCode1651',
                    name: 'workItemName1652',
                    remark: 1,
                    productCategoryCode: 'productCategoryCode1653',
                    productCategoryName: 'productCategoryName1654',
                    laborHour: 1
                },
                {
                    id: 'workItemId1655',
                    code: 'workItemCode1656',
                    name: 'workItemName1657',
                    remark: 1,
                    productCategoryCode: 'productCategoryCode1658',
                    productCategoryName: 'productCategoryName1659',
                    laborHour: 1
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.code 项目编号
 * @param {} options.name 项目编号
 * @param {} options.workItemCategoryId 维修项目分类Id，维修项目所关联的分类或其上层分类Id
 * @param {} options.productCategoryId 产品分类Id（车型Id）
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/export', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        workItemCategoryId: req.query.workItemCategoryId,
        productCategoryId: req.query.productCategoryId,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: 'payload'
    };
    res.json(data);
});
module.exports = router;
